﻿<!DOCTYPE html>
<html>
<head>
    <title>OpenLayers Map</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
	<script src="../js/jquery-1.7.2.min.js"></script>
    <script src="../js/lib/OpenLayers-2.11/OpenLayers.js"></script>
	<script type="text/javascript" src="../js/lib/OpenLayers-2.11/lib/OpenLayers/Layer/GoogleTile.js"></script>
	
    <script type="text/javascript">
        var proj = 'EPSG:26915';
        var lodLength = 20;
        var resolutions = [];
        var resolution = 156543.033928;
        for (var i = 0; i < lodLength; i++) {
            resolutions.push(resolution);
            resolution /= 2;
        }
        var tileSize = new OpenLayers.Size(256, 256);
        var agsTileOrigin = new OpenLayers.LonLat(-20037508.342787, 20037508.342787);
        var mapExtent = new OpenLayers.Bounds(-20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787);

        var map;
        function init() {
         format = 'image/png';
            map = new OpenLayers.Map('map', {
                maxExtent: mapExtent,
			    displayProjection: new OpenLayers.Projection("EPSG:4326"),
                controls: [
		            new OpenLayers.Control.Navigation(),
		            new OpenLayers.Control.LayerSwitcher(),
		            new OpenLayers.Control.PanZoomBar(),
		            new OpenLayers.Control.MousePosition()
				]
            });
			//http://mt0.google.cn/vt/lyrs=s@118&hl=zh-CN&gl=CN&src=app&x=${x}&y=${y}&z=${z}&s=Galile
			//http://mt2.google.cn/vt/lyrs=s@113&hl=zh-CN&gl=cn&src=app&s=Galile&x=${x}&y=${y}&z=${z}
            var baseLayer = new OpenLayers.Layer.GoogleTile('google 影像地图',
				'http://mt0.google.cn/vt/lyrs=s@118&hl=zh-CN&gl=CN&src=app&x=${x}&y=${y}&z=${z}&s=Galile',
				{
                tileOrigin: agsTileOrigin,
                resolutions: resolutions,
                sphericalMercator: true,
                maxExtent: mapExtent,
                isBaseLayer: true,
                type: 'png'
                //projection: proj
            });
            
			
			var Layer = new OpenLayers.Layer.GoogleTile('google 矢量地图',
				'http://mt1.google.cn/vt/lyrs=m@189000000&hl=zh-CN&gl=CN&src=app&x=${x}&s=&y=${y}&z=${z}&s=Ga',
				{
                tileOrigin: agsTileOrigin,
                resolutions: resolutions,
                sphericalMercator: true,
                maxExtent: mapExtent,
                isBaseLayer: true,
                type: 'png'
                //projection: proj
            });
			
			
            map.addLayers([Layer,baseLayer]);
			var center=new OpenLayers.LonLat(103.222595,35.70737).transform(map.displayProjection,map.getProjectionObject());
			map.setCenter(center, 4);  //添加平移缩放工具条

			
			
        }

 
    </script>
</head>
<body onload="init()">
    <div id="map" style="width: 100%; height: 600px">
    </div>
</body>
<script>
	$(document).ready(function(){
		var height=$(window).height()-40;
		$("#map").height(height);
	});
</script>
</html>
